package org.dromara.article.controller;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.article.domain.KeywordsDict;
import org.dromara.article.domain.vo.KeywordsDictQueryVo;
import org.dromara.article.service.KeyWordsService;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.*;

/**
 * 字典管理接口
 */
@Slf4j
@RestController
@RequestMapping("/kw")
public class KeyWordsController {

    @Resource
    private KeyWordsService keyWordsService;

    /**
     * 查询字典列表
     *
     * @param queryVo
     * @param pageQuery
     * @return
     */
    @GetMapping("/list")
    public TableDataInfo<KeywordsDict> list(KeywordsDictQueryVo queryVo, PageQuery pageQuery) {
        return keyWordsService.list(queryVo, pageQuery);
    }

    /**
     * 添加字典
     *
     * @param keywordsDict
     * @return
     */
    @PostMapping("/add")
    public R<Void> add(KeywordsDict keywordsDict) {
        return keyWordsService.add(keywordsDict);
    }

    /**
     * 更新字典信息
     *
     * @param keywordsDict
     * @return
     */
    @PutMapping("/update")
    public R<Void> update(KeywordsDict keywordsDict) {
        return keyWordsService.update(keywordsDict);
    }


}
